#
#   Character.py
#
#   This program is free software; you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation; version 2 of the License.
#
#   This program is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   Copyright
#   Author: Nicholas F. Hoover
#   Contributors: Salvatore S. Gionfriddo
#   Created: 2007.06.30
#   Last Modified: 2007.07.08
#

from GameObject import GameObject


class Character(GameObject):
    """This is a GameObject with heatlh"""
    
    MIN_HEALTH = 0
    MAX_HEALTH = 100

    def __init__(self):
        GameObject.__init__(self)

        self.health = Character.MAX_HEALTH
        
    def incHealth(self,amount):
        self.health += amount
        if self.health > self.MAX_HEALTH: self.health = self.MAX_HEALTH
   
    def decHealth(self,amount):
        self.health -= amount
        if self.health < self.MIN_HEALTH: self.health = self.MIN_HEALTH        

    def isAlive(self):
        return self.health > self.MIN_HEALTH
